home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8653 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c,comp.unix.programmer
  4. Subject: Re: shellscript to c
  5. Followup-To: comp.unix.programmer
  6. Date: 5 Mar 1996 09:39:36 -0800
  7. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  8. Message-ID: <4hhu8oINN543@keats.ugrad.cs.ubc.ca>
  9. References: <4hhps3$cof@news.tuwien.ac.at>
  10. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  11.  
  12. In article <4hhps3$cof@news.tuwien.ac.at>,
  13. Christoph Mack <cmack@rainbow.studorg.tuwien.ac.at> wrote:
  14.  >Hi!
  15.  >
  16.  >I am currently writing a compiler which will be able to translate
  17.  >bourne shell scripts to C. I hope that this will speed the scripts 
  18.  >up a bit.
  19.  
  20. Not likely; at least, not sensible scripts that are used for things that, well,
  21. scripts ought to be used for, which is the coordination of other commands, file
  22. manipulation, and the like. More time is spent in the external commands than in
  23. the interpreter itself.
  24.  
  25.  >The strategie is to do a fork and exec for each unix system call.
  26.  >One problem is output redirection. Does anyone know how to realize
  27.  ><sc1> | <sc2> in C where <sc1> and <sc2> are unix system calls?
  28.  >
  29.  >e.g.: ls -lsa | grep vmlinuz
  30.  >      cat textfile.txt | grep "certain words"
  31.  
  32. ls and grep are not ``system calls''. They are system utility programs. System
  33. calls are kernel functions like kill() or open().
  34.  
  35. If you don't know how to set up the execution of pipelines, don't write a shell
  36. translator into C. It's not a trivial job! You will be tearing your hair out
  37. within a few days or weeks.
  38.  
  39. (redirected to comp.unix.programmer)
  40. -- 
  41.  
  42.